package com.ithiem.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.dubbo.api.TestSoulApi;
import com.itheima.model.domain.TestSoul;
import com.ithiem.dubbo.mappers.TestSoulMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class TestSoulApiImpl implements TestSoulApi {
    @Autowired
    private TestSoulMapper testSoulMapper;

    @Override
    public void save(TestSoul testSoul) {
        testSoulMapper.insert(testSoul);
    }

    @Override
    public List<TestSoul> list() {
        LambdaQueryWrapper<TestSoul> lqw = new LambdaQueryWrapper<>();
        lqw.orderByAsc(TestSoul::getLevel);
        return testSoulMapper.selectList(lqw);
    }
}
